<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, maximum-scale=1.0, minimum-scale=0">
<meta name="format-detection" content="telephone=no" />
<script src="./b.js"></script>
<title>分页</title>
</head>
<body>
<script>
    var audio_context;
    var recorder;
    var au = new Audio();
    var lStat = true;
    var openRecorder = function () {
        window.AudioContext = window.AudioContext || window.webkitAudioContext;
        navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
        window.URL = window.URL || window.webkitURL;

        audio_context = new AudioContext;
        alert(navigator.getUserMedia)
        navigator.getUserMedia({
            audio: true
        }, startUserMedia, function (e) {
            alert(e)
          if(e=="DOMException"){
            alert('没有插入麦克风,重新插入麦克风后刷新页面');
            lStat=false;  
          }
        },function(e){
          alert(e)
        })
    };

    function startUserMedia(stream) {
        alert(2)
        var input = audio_context.createMediaStreamSource(stream);
        recorder = new Recorder(input);
    }
    openRecorder();

</script>
</body>
</html>
